<template>
    <div class="btn-container">
        <div :class="['btn',{'disable':cancelDisabled}]"
             :style="{ color: cancelTextColor }"
             v-if="cancelShow"
             @click="cancel">{{cancelText}}</div>
        <div class="line" v-if="cancelShow"></div>
        <div :class="['btn',{'disable':confirmDisabled}]"
             :style="{ color: confirmTextColor }"
             @click="confirm">{{confirmText}}</div>
    </div>
</template>

<script>
export default {
    props: {
        confirmText: {
            type: String,
            default()  {
                return this.$t('confirm');
            }
        },
        cancelText: {
            type: String,
            default() {
                return this.$t('cancel');
            }
        },
        confirmTextColor: {
            type: String,
            default: ''
        },
        cancelTextColor: {
            type: String,
            default: ''
        },
        cancelDisabled: {
            type: Boolean,
            default: false
        },
        confirmDisabled: {
            type: Boolean,
            default: false
        },
        cancelShow: {
            type: Boolean,
            default: true
        }
    },
    methods: {
        cancel() {
            if (this.cancelDisabled) {
                return;
            }
            this.$emit('cancel');
        },
        confirm() {
            if (this.confirmDisabled) {
                return;
            }
            this.$emit('submit');
        }
    }
};
</script>

<style lang="less" scoped>
@import url("../style/public.less");
.btn-container {
    height: 5.6rem;
    padding: 0 1.6rem 1.6rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--emui_text_size_button1);
    color: var(--emui_accent);
    .medium();
    .btn {
        height: 4rem;
        margin: 0 0.4rem;
        flex: 1;
        line-height: 4rem;
        text-align: center;
        .active(@radius:2rem);
    }
    .disable {
        opacity: 0.5;
    }
    .line {
        .borderR(@size:0.5, @height:2.4rem, @right:50%);
    }
}
</style>
